<?php
/**
 * Created by PhpStorm.
 * User: xiongrui
 * Date: 2017-06-30
 * Time: 17:17
 */

namespace app\admin\validate;




class GoodsValidate extends BaseValidate
{
  protected $rule = [
      'good_name'    => 'require|length:3,100',
      'cover_id'    => 'require',
      'good_desc'    => 'require',
      'rule_name'    => 'isArrayEmpty:规格名称',
      'rule_price'    => 'isArrayEmpty:测试1',
      'rule_price2'    => 'isArrayEmpty:测试2',
      'rule_price3'    => 'isArrayEmpty:价格33',
      'rule_price4'    => 'isArrayEmpty:价格4',
      'market_price'    => 'isArrayEmpty:市场价格',
    //  'stock'    => 'isArrayEmpty:规格库存',

  ];

  protected $message = [
      'good_name.require' => '标题不能为空',
      'good_name.length' => '标题长度为3-100',
      'cover_id.require' => '须上传商品图片',
      'good_desc.require' => '特色表示不能为空',
  ];

  protected function isArrayEmpty($value,$rule,$data){
      foreach ($value as $v) {
        //if($v == false || $v == '0.00'){
        if($v == "" ){
          return $rule.'不能为空';
        }
      }
      return true;
  }


}
